import book.bookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * @Author @fiber-cloud
 * @Date 2025/7/13 15:34
 */
public class Main {
    //登录函数
    public static User login(){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的用户名");
        String username = sc.nextLine();
        System.out.println("请输入你的身份 1-》管理员，0-》普通用户");
        int userType = sc.nextInt();
        if (userType == 1){
            return new AdminUser(username);
        }else {
            return new NormalUser(username);
        }
    }
    public static void main(String[] args) {
        //实例化书架上已经存在的三本书
        bookList bookList = new bookList();

        User user = login();

        while (true){
            int choice = user.menu();
            user.toOpertation(choice,bookList);
        }
    }
}
